package com.spring.prototype_demo;

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * 全局上下文工具类使用
 * 依赖xml: <import resource="spring-prototype.xml"/>
 * 工厂模式的升级使用
 * 关键类：ServiceLocatorFactoryBean
 * 学习:  https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/beans/factory/config/ServiceLocatorFactoryBean.html
 *
 */
public class Apps {

	public static void main(String[] args) {
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
		MyClientBean myClientBean = (MyClientBean) context.getBean("clientBean");
		myClientBean.someBusinessMethod();
		MyClientBean myClientBean2 = (MyClientBean) context.getBean("clientBean2");
		myClientBean2.someBusinessMethod();
	}
}
